package com.kgc.scd.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kgc.scd.bean.Comment;
import com.kgc.scd.bean.Product;
import com.kgc.scd.bean.ProductVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface ProductMapper extends BaseMapper<Product> {



   @Select("SELECT c.comm_content  ,count(c.comm_id ) from product p ,`comment` c " +
            "WHERE c.comm_proid = #{proId}GROUP BY p.pro_name LIMIT #{pageNo} , #{pageSize};")
    List<Comment> productList(String proId,Integer pageNo,Integer pageSize);
    // 带评论数目的商品查询
    // @Select("SELECT p.pro_name,count(#{commId}) FROM product p,`comment` c WHERE p.pro_id= c.comm_proid")
    ProductVO productById(String proId);

    /*long countByExample(ProductExample example);

    int deleteByExample(ProductExample example);

    int deleteByPrimaryKey(String proId);

    int insert(Product record);

    int insertSelective(Product record);

    List<Product> selectByExample(ProductExample example);

    Product selectByPrimaryKey(String proId);

    int updateByExampleSelective(@Param("record") Product record, @Param("example") ProductExample example);

    int updateByExample(@Param("record") Product record, @Param("example") ProductExample example);

    int updateByPrimaryKeySelective(Product record);

    int updateByPrimaryKey(Product record);*/
}